<extend name="Public/base"/>

<block name="style">
	
	<style type="text/css">
	.choosed{
		height: 83%;
	}
	
	.not-choosed{
		
		height: 83%;
	}
	.fl{
		float: left;
		margin:0 10px;
	}
	.well{
		background: #fff;
	}
	</style>
</block>

<block name="body">
<script type="text/css">
  .add{
       width:100px; 
      }
</script>

<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="main-title cf">
        <h2>
            <if condition="ACTION_NAME eq 'add'">新增展会
                <else/>  编辑展会
            </if>
        </h2>
    </div>
    <!-- 表单 -->
  <form action="" method="post" class="form-horizontal">
    <div class="with-padding">
    
    <div class="tab-wrap" style="margin-bottom: 5px">
        <ul class="nav nav-secondary group_nav">
            <li class="active"><a href="javascript:">基本信息</a></li>
            <li class=""><a href="javascript:">详细信息</a></li>            
        </ul>
    </div>
    
                    <!--看板-->
        <div class="group_list" style="">
        
				   <div class="form-item cf">
		                <label class="item-label">展会名称<span class="check-tips"></span></label>		
		                <div class="controls">
		                    <input type="text" class="text input-large form-control form-input-width" name="zname"
		                           value="{$data.zname}">
		                </div>
                   </div>
            
            </br>
             <div class="form-item cf">
                <label class="item-label">展会类型<span class="check-tips"></span></label>
 				
 				<if condition="$data['type'] neq '专题展会'">
 				
 				    <div class="controls">
	                <label class="line-height-1 blue">               
	                    <input name="type" value=" 专题展会" type="radio" checked="checked" >
	                    <span class="lbl"> 专题展会</span>
	                </label>

	                <label class="line-height-1 blue">
	                    <input name="type" value="区域性展会" type="radio">
	                    <span class="lbl"> 区域性展会</span>
	                </label>
                </div>
 					
 				<else />
 				
 				<if condition="$data['type'] eq '区域性展会'">
 				
 				    <div class="controls">
	                <label class="line-height-1 blue">               
	                    <input name="type" value="专题展会" type="radio" >
	                    <span class="lbl"> 专题展会</span>
	                </label>

	                <label class="line-height-1 blue">
	                    <input name="type" value="区域性展会" type="radio" checked="checked">
	                    <span class="lbl"> 区域性展会</span>
	                </label>
                </div>
             
                <else />
                <div class="controls">
	                <label class="line-height-1 blue">               
	                    <input name="type" value="1" type="radio" >
	                    <span class="lbl"> 专题展会</span>
	                </label>

	                <label class="line-height-1 blue">
	                    <input name="type" value="2" type="radio">
	                    <span class="lbl"> 区域性展会</span>
	                </label>
                </div>
                
                </if>
              </if>
            </div> 
            
             <br/>
            <div class="form-item cf">

				<section>
				  <label class="item-label">报名截止时间<span class="check-tips"></span></label>
				  <article>
				    <div class="example">
			      <input type="text" name="btime" class="text input-large form-control form-input-width form-control form-date" placeholder=
				      "选择或者输入一个日期：yyyy-MM-dd" value="{$data.btime}">
				    </div>
				  </article>
				</section>

           </div>
              
             </br>
             
            <div class="form-item cf">

				<section>
				  <label class="item-label">展会时间<span class="check-tips"></span></label>
				  <article>
				    <div class="example">
			      <input type="text" name="stime" class="text input-large form-control form-input-width form-control form-date" placeholder=
				      "选择或者输入一个日期：yyyy-MM-dd" value="{$data.stime}" >至
				      <input type="text" name="etime" class="text input-large form-control form-input-width form-control form-date" placeholder=
				      "选择或者输入一个日期：yyyy-MM-dd" value="{$data.etime}">
				    </div>
				  </article>
				</section>

           </div>
          <br/>
          
                      
		      <div class="form-item cf">
			       <label class="item-label">技术标签<span class="check-tips"></span></label>
			
			       <div class="controls">
			           <label class="line-height-1 blue" style="margin-right:20px">
		                    <input name="tID[]" value="1" type="checkbox" checked="checked">
		                    <span class="lbl">技术创新</span>
	                    </label>
                        
		                <label class="line-height-1 blue" style="margin-right:20px">
		                    <input name="tID[]" value="2" type="checkbox">
		                    <span class="lbl">创新</span>
		                </label>
	                
		                <label class="line-height-1 blue" style="margin-right:20px">
		                    <input name="tID[]" value="3" type="checkbox">
		                    <span class="lbl">节能环保</span>
		                </label>
		                
		                <label class="line-height-1 blue" style="margin-right:20px">
		                    <input name="tID[]" value="4" type="checkbox">
		                    <span class="lbl">智能家电</span>
		                </label>
		                 <label class="line-height-1 blue" style="margin-right:20px">
		                    <input name="tID[]" value="5" type="checkbox">
		                    <span class="lbl">节能</span>
		                </label>
		                 <label class="line-height-1 blue" style="margin-right:20px">
		                    <input name="tID[]" value="6" type="checkbox">
		                    <span class="lbl">健康</span>
		                </label>
			       </div>
			  </div>
                            
       </div>

        <div class="group_list" style="display: none;">

			   
			<div class="form-item cf">
                <label class="item-label">展会介绍<span class="check-tips"></span></label>
                  <textarea name="zhjs" class="form-control" style="width: 400px;height: 200px" >{$data.zhjs}</textarea>
            </div>
            <br/>
            <div class="form-item cf">
                <label class="item-label">预计规模：<span class="check-tips"></span></label><br/>
                <label class="item-label">项目需求数：<span class="check-tips"></span></label>
                <div class="controls">
                   <input type="text" class="text input-large form-control form-input-width" name="yjxq"
                          value="{$data.yjxq}">
               </div>
               
               <label class="item-label">项目成果数：<span class="check-tips"></span></label>
                <div class="controls">
                   <input type="text" class="text input-large form-control form-input-width" name="yjjs"
                          value="{$data.yjjs}">
               </div>
               <br/>
            </div>
            
          
         <div class="form-item cf">
                <label class="item-label">上传图片<span class="check-tips"></span></label>
			<div class="controls">
               <div id="upload_single_image_" style="padding-bottom: 5px;">选择图片</div>
                  <input class="attach" type="hidden" name="" value="{$data.pic}"/>
               <div class="upload-img-box">
                   <div class="upload-pre-item popup-gallery">
				      <notempty name="data.pic">
						<div class="each">
							<a href="{$data.pic}" title="点击查看大图"><img src="{$data.pic}"></a>
							<div class="text-center opacity del_btn" ></div>
							<div onclick="admin_image.removeImage($(this),'+data.id+')"  class="text-center del_btn">删除</div>
						</div>
                    </notempty>           
                 </div>
               </div>
           </div>
        <script>
            $(function () {
                var uploader_= WebUploader.create({
                    // 选完文件后，是否自动上传。
                    auto: true,
                    // swf文件路径
                    swf: 'Uploader.swf',
                    // 文件接收服务端。
                    server: "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
                    // 选择文件的按钮。可选。
                    // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                    pick: '#upload_single_image_',
                    // 只允许选择图片文件
                    accept: {
                        title: 'Images',
                        extensions: 'gif,jpg,jpeg,bmp,png',
                        mimeTypes: 'image/*'
                    }
                });
                uploader_.on('fileQueued', function (file) {
                    uploader_.upload();
                });
                /*上传成功**/
                uploader_.on('uploadSuccess', function (file, data) {
                    if (data.status) {
                        $("[name='']").val(data.id);
                        $("[name='']").parent().find('.upload-pre-item').html(
                                '<input type="hidden" name="pic" value="'+ data.path+'"/><div class="each"><a href="'+ data.path+'" title="点击查看大图"><img src="'+ data.path+'"></a><div class="text-center opacity del_btn" ></div>' +
                                        '<div onclick="admin_image.removeImage($(this),'+data.id+')"  class="text-center del_btn">删除</div></div>'
                        );
                        uploader_.reset();
                    } else {
                        updateAlert(data.info);
                        setTimeout(function () {
                            $('#top-alert').find('button').click();
                            $(that).removeClass('disabled').prop('disabled', false);
                        }, 1500);
                    }
                });
            })
        </script> 
    </div>
            
         </div> 
    
</div>
 
   
</div> 
								
            <div class="form-item">
                <input type="hidden" name="id" value="{$data.id}"/>
                <button class="btn submit-btn ajax-post btn-success" id="submit" type="submit" target-form="form-horizontal" style="margin-left:12px">保存</button>
<!--                 <button type="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">保存</button> -->
<!--                 <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">确定</button> -->
            </div>
        </form>
    </div>

</block>

<block name="script">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <script type="text/javascript" charset="utf-8">
    Think.setValue('csd', {$data.csd|default = 1});
    Think.setValue('hztype', {$data.hztype|default = 1});
        //导航高亮
     highlight_subnav('{:U('Hostactivity/index')}');
    </script>
    
    <link type="text/css" rel="stylesheet" href="/duijie/Public/js/ext/magnific/magnific-popup.css"/>
    <script type="text/javascript" src="/duijie/Public/js/ext/magnific/jquery.magnific-popup.min.js"></script>

    <script type="text/javascript" charset="utf-8" src="/duijie/Public/js/ext/webuploader/js/webuploader.js"></script>
    <link href="/duijie/Public/js/ext/webuploader/css/webuploader.css" type="text/css" rel="stylesheet">
   
    <!-- 时间控件 -->
    <script type="text/javascript" src="/duijie/Public/zui/lib/kindeditor/lang/zh_CN.js"></script>
    <script type="text/javascript" src="/duijie/Public/js/datetimepicker.min.js"></script>
    <link href="/duijie/Public/css/datetimepicker.min.css" rel="stylesheet">
    
    <script>

$(".form-date").datetimepicker(
		{
		    language:  "zh-CN",
		    weekStart: 1,
		    todayBtn:  1,
		    autoclose: 1,
		    todayHighlight: 1,
		    startView: 2,
		    minView: 2,
		    forceParse: 0,
		    format: "yyyy-mm-dd"
		});

function afterPageLoad() {
    $.getScript('/duijie/Public/js/datetimepicker.min.js', function() {
        if($.fn.datetimepicker)
        {
            $('#pageBody .form-datetime').datetimepicker(
            {
                weekStart: 1,
                todayBtn:  1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                forceParse: 0,
                showMeridian: 1,
                format: 'yyyy-mm-dd hh:ii'
            });
            $('#pageBody .form-date').datetimepicker(
            {
                language:  'zh-CN',
                weekStart: 1,
                todayBtn:  1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                minView: 2,
                forceParse: 0,
                format: 'yyyy-mm-dd'
            });
            $('#pageBody .form-time').datetimepicker({
                language:  'zh-CN',
                weekStart: 1,
                todayBtn:  1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 1,
                minView: 0,
                maxView: 1,
                forceParse: 0,
                format: 'hh:ii'
            });
        }
    });
}
</script>
 
    <script type="text/javascript">
    $(function () {
        $('.group_nav li a').click(function () {
            $('.group_list').hide();
            $('.group_list').eq($(".group_nav li a").index(this)).show();
            $('.group_nav li').removeClass('active');
            $(this).parent().addClass('active');
        })
    })
    </script>

  <!--   二级联动 -->
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
    $('#type').click(function(){
        $(this).change(function(){
            var objectModel = {};
            var   value = $(this).val();
           var   type = $(this).attr('id');
          // var   lable = $(this).attr('id');
            objectModel[type] =value;
           // objectModel[lable] =value;
            $.ajax({
                cache:false,
                type:"POST",
                url:'{:U('lable')}',
                dataType:"json",
                data:objectModel,
                timeout:30000,
                error:function(){
                    alert(site.web+"lable");
                },
                success:function(data){
                    $("#lables").empty();
                    var count = data.length;
                    var i = 0;
                    var b="";
                       for(i=0;i<count;i++){
                           b+="<option value='"+data[i].id+"'>"+data[i].name+"</option>";
                       }
                    $("#lables").append(b);
                }
            });
           });
    }
);
    
    $('.choosed-form , .not-choosed').ace_scroll({size: 300});
    $.app = {
    	students:function(){
    		setChoosed();
    		function setChoosed(){
    			// resizeScroll();
    			var ids = [];
    			var not_ids = [];
    			$(".choosed-form input").each(function(){
    				ids[ids.length] = $(this).data("id");
    			});
    			$(".not-choosed input").each(function(){
    				not_ids[not_ids.length] = $(this).data("id");
    			});
    			$("#ids").attr("value",ids);
    			$("#not_ids").attr("value",not_ids);
    			$(".choosed-form input").unbind("click").bind("click",choose);
    			$(".not-choosed input").unbind("click").bind("click",unchoose);
    		}
    		function choose(){
    			$(this).prependTo(".not-choosed .scroll-content");
    			$(this).removeClass('animated lightSpeedIn')
    				   .addClass('animated fadeInLeft');
    			setChoosed();
    		}
    		function unchoose(){
    			$(this).prependTo(".choosed-form .scroll-content");
    			$(this).removeClass('animated fadeInLeft')
    			       .addClass('animated lightSpeedIn');
    			setChoosed();

    		}
    	}
    }
    //执行
    $.app.students();
    
    </script>
     
     <script>
        $(document).ready(function () {
            $('.popup-gallery').each(function () { // the containers for all your galleries
                $(this).magnificPopup({
                    delegate: 'a',
                    type: 'image',
                    tLoading: '正在载入 #%curr%...',
                    mainClass: 'mfp-img-mobile',
                    gallery: {
                        enabled: true,
                        navigateByImgClick: true,
                        preload: [0, 1] // Will preload 0 - before current, and 1 after the current image

                    },
                    image: {
                        tError: '<a href="%url%">图片 #%curr%</a> 无法被载入.',
                        titleSrc: function (item) {
                            /*           return item.el.attr('title') + '<small>by Marsel Van Oosten</small>';*/
                            return '';
                        },
                        verticalFit: true
                    }
                });
            });
                    });
    </script> 

</block>
